<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<script type="text/javascript">
var tool =[{
	text:"同意",
	iconCls:"icon-edit",
	handler:function(){
		var obj  = $("#ta").datagrid("getSelections");
		if(obj == null || obj.length != 1){
			$.messager.alert('提示','对不起，请选择单条数据');
		}else{
			$.post("Warehouse/agreeApplication",{"logid":obj[0].logid,"applicationnum":obj[0].applicationnum,"drugname":obj[0].drugname},function(data){
				if(data.state == 200){
					$.messager.alert('提示','同意进货');
					$("#ta").datagrid("reload");
				}else{
					$.messager.alert('提示','进货失败');
				}
			});
		}
	}
},{
	text:"拒绝",
	iconCls:"icon-edit",
	handler:function(){
		var obj  = $("#ta").datagrid("getSelections");
		if(obj == null || obj.length != 1){
			$.messager.alert('提示','对不起，请选择单条数据');
		}else{
			$.post("Warehouse/disagreeApplication",{"logid":obj[0].logid},function(data){
				if(data.state == 200){
					$("#ta").datagrid("reload");
					$.messager.alert('提示','拒绝进货');
				}
			});
		}
	}
}];
</script>
<table id="ta" class="easyui-datagrid" style="width:63%" data-options="toolbar:tool,pagination:true,url:'Warehouse/findApplication',fitColumns:true,singleSelect:true">
	<thead>
		<tr >
			<th data-options="field:'ck',checkbox:true"></th>
			<th data-options="field:'logid',width:200,align:'center',sorttable:true">申请编号</th>
			<th data-options="field:'drugname',width:200,align:'center',sorttable:true">药品名称</th>
			<th data-options="field:'providerid',width:200,align:'center',sorttable:true">生产商</th>
			<th data-options="field:'logcontent',width:200,align:'center',sorttable:true">申请说明</th>
			<th data-options="field:'applicationnum',width:200,align:'center',sorttable:true">申请数量</th>
			<th data-options="field:'applicationname',width:200,align:'center',sorttable:true">申请人</th>
		</tr>
	</thead>
</table>